package com.ea.admin.pojo.param.file;

import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class UploadChunkParam {

    /**
     * 文件块编号，从1开始
     */
    @ApiModelProperty(value = "文件块编号，从1开始", required = true)
    @NotNull(message = "文件块编号不能为空")
    private Integer index;

    /**
     * 文件标识MD5
     */
    @ApiModelProperty(value = "文件标识MD5", required = true)
    @NotBlank(message = "文件标识不能为空")
    private String md5;

    /**
     * 总块数
     */
    @ApiModelProperty(value = "总块数", required = true)
    @NotNull(message = "总块数不能为空")
    private Integer totalChunks;

    /**
     * 块内容
     */
    @JSONField(serialize = false)
    @ApiModelProperty(value = "块内容", required = true)
    private MultipartFile chunk;

    @ApiModelProperty(value = "文件类型", required = true)
    @NotBlank(message = "文件类型不能为空")
    private String type;
}
